package com.chenglai.seckill.feign;

import com.chenglai.commonutils.common.Result;
import com.chenglai.seckill.entity.MainOrder;
import com.chenglai.seckill.entity.Order;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * 类描述：
 *
 * @Author rxh
 * @Date 2023/11/21 15:04
 */
@Component
public class OrderFallback implements FallbackFactory<OrderService> {

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Override
    public OrderService create(Throwable cause) {
        return new OrderService() {
            @Override
            public String addMainOrder(MainOrder mainOrder, List<Order> orders) {
                return "服务异常";
            }

            @Override
            public Map<String, Object> queryRefundParam(String orderNum) {
                return null;
            }
        };
    }
}
